import type{ IFormData } from './types';

export class FileFormData implements IFormData {
  file_name: string = '';
  file_type: string = '';
  file_size: number = 0;
  file_path: string = '';
  createTime: string = '';
  updateTime: string = '';

  constructor(data?: Partial<FileFormData>) {
    this.reset();
    if (data) Object.assign(this, data);
  }

  reset(): void {
    Object.assign(this, {
      file_name: '',
      file_type: '',
      file_size: 0,
      file_path: '',
      createTime: '',
      updateTime: ''
    });
  }

  toSubmitData() {
    return {
      file_name: this.file_name,
      file_type: this.file_type,
      file_size: this.file_size,
      file_path: this.file_path
    };
  }
}